#============================================================
#	Draw Circle
#============================================================
#  绘制圆点
#============================================================
# @datetime: 2022-3-26 16:05:02
#============================================================
class_name DrawCirclePoint
extends Node2D


const Colors = [
	Color.red,
	Color.aqua,
	Color.deepskyblue,
	Color.chartreuse,
	Color.coral,
	Color.cornflower,
	Color.cyan,
	Color.darkkhaki,
	Color.darksalmon,
	Color.darkseagreen,
	Color.deeppink,
	Color.orange,
	Color.darkturquoise,
	Color.khaki,
	Color.yellow,
	Color.mediumspringgreen,
	Color.orangered,
	Color.yellowgreen
]


export var radius : int = 32
export var cell_size : Vector2 = Vector2(64, 64)
export var color : Color = Color.red


var _point_path : Array


func _draw():
	var radius_size : Vector2 = Vector2(radius, radius)
	var offset : Vector2 = radius * (cell_size / (radius * 2))
	var index = 0
	for points in _point_path:
		var c : Color = color
		if index > 0:
			c = Colors[index % Colors.size()]
		for pos in points:
			draw_circle(pos * cell_size + offset , radius, c)
			index += 1


func draw_by_points(points: Array):
	draw_by_point_group([points])


func draw_by_point_group(point_path: Array):
	_point_path = point_path
	update()

